/**
 * create by young (young2f@outlook.com) on 2020/12/4
 */
'use strict';
const model = require('../base/tModelBase');
const _ = require('lodash');
module.exports = app => {
  const mongoose = app.mongoose;
  const schema = mongoose.Schema;
  const connect = app.mongooseDB.get('pmcBus');
  const json = {
    filename: { type: String, _type: 'string', title: '文件名称', required: true, enableArea: [
        'table'
      ] },
    code: { type: String, _type: 'code', title: '编码', required: true },
    treeId: { type: String, _type: 'string', title: '目录', required: true, enableArea: [
        'table'
      ] },

    memo: { type: String, _type: 'string', title: '备注', enableArea: [

      ] },
    fileList: { type: Array, _type: 'fileList', title: '列表' },

  };
  const _model = _.cloneDeep(model);
  _.assign(_model, json);
  const _schema = new schema(
    _model,
    { timestamps: { createdAt: 'createdTs', updatedAt: 'updatedTs' } }
  );
  return connect.model('DicFile', _schema);
};
